<?php

class User_Form_Search extends Zend_Form {
    public function init()
    {
        $this->setMethod('get')
            ->setAction('/user/search/')
            ->setName('searchuserform');

        $phrase = new Zend_Form_Element_Text('q');
        $phrase->setLabel('Search user')
            ->setDescription('Please enter a search phrase')
            ->setRequired(true);

        $submit = new Koncept_Form_Element_Submit('btnS');
        $submit->setLabel('Search');

        $this->addElements(array($phrase, $submit));
        $this->addDisplayGroup(array('q', 'btnS'), 'searchgroup');

        $group = $this->getDisplayGroup('searchgroup');
        $group->setDecorators(array(
            array('FormElements'),
            array('HtmlTag', array('tag' => 'span',
                    'class' => 'formButtons')),
            array('DtDdWrapper'),
        ));
    }

    public function setPhrase($phrase = '')
    {
        $this->getElement('q')->setValue($phrase);
    }

}

